package com.gmaf.mas.launch.resloader;

import java.util.List;

import com.gmaf.mas.launch.property.Configuration;
import com.gmaf.mas.launch.property.Executor;
import com.gmaf.mas.launch.property.PropertyParser;

public class ResourceLoaderBuilder implements Executor
{
	private String type = null;
	private String value = null;
	
	private List<ResourceLoader> resLoaders = null;
	
	public ResourceLoaderBuilder(List<ResourceLoader> resLoaders)
	{
		this.resLoaders = resLoaders;
	}
	
	@Override
	public void execute(PropertyParser parser, Configuration config)
	{
		if(resLoaders == null)
		{
			return;
		}

		if("file".equals(type))
		{
			String str = parser.parseProperty(value, config);
			resLoaders.add(new FileResourceLoader(str));
		}
		else
		{
//			log.error("Unkown resource loader type: " + type);
			return;
		}
	}


	public String getType()
	{
		return type;
	}


	public void setType(String type)
	{
		this.type = type;
	}


	public String getValue()
	{
		return value;
	}


	public void setValue(String value)
	{
		this.value = value;
	}

}
